"""
返回值
return
作用:
1 就是把函数的结果给到调用者
2 终止函数  return之后的代码将不在执行
3 也可以终止循环
"""

def sum_num(num1):   #此时num:形参
    sum1=0
    for a in range(num1+1):
        sum1+=a
    # return sum1
    print(sum1)
# sum2=sum_num(100)
# print(sum2/100)
print(sum_num(100))

# def sixunhuan(n):
#
#     while True:
#         print(n)
#         if n==3:
#             return
#
#
# sixunhuan(3)

def range_sum(start,stop):
    sum1=0
    for a in range(start,stop):
        sum1+=a
    return  sum1


print(range_sum(1, 100))